import { useMemo } from 'react'

export const useFilter = (list = [], name = '') => {
  // 计算属性
  const computedList = useMemo(() => {
    return list.filter(
      (item) =>
        item.name.toUpperCase().includes(name.toUpperCase()) ||
        item.address.toUpperCase().includes(name.toUpperCase())
    )
  }, [name, list])
  return {
    computedList,
  }
}
